package com.tjtt.tdm.system.service.impl;

import java.util.List;

import com.tjtt.tdm.exception.DaoException;
import com.tjtt.tdm.system.bean.UserRole;
import com.tjtt.tdm.system.dao.UserRoleDao;
import com.tjtt.tdm.system.service.UserRoleService;

public class UserRoleServiceImpl implements UserRoleService {
	private UserRoleDao userRoleDao;

	

	//删除用户角色关联
	public void delUserRoleByRoleId(Long roleId) throws DaoException {
		userRoleDao.delUserRoleByRoleId(roleId);	
	}

	//分配人员
	/*public UserRole savaUserToRole(UserRole userRole) {
		return userRoleDao.savaUserToRole(userRole);
	}*/
	
	public void updateURAll(String roleId, List<UserRole> userRole) throws DaoException {
		    this.delUserRoleByRoleId(Long.parseLong(roleId));
			for(int i = 0; i< userRole.size(); i++){
				UserRole us = (UserRole)userRole.get(i);
				userRoleDao.savaUserToRole(us);
			}
	}
	
	public void delUserRole(Long userId) throws DaoException {
		userRoleDao.delUserRole(userId);	
	}
	public UserRoleDao getUserRoleDao() {
		return userRoleDao;
	}

	public void setUserRoleDao(UserRoleDao userRoleDao) {
		this.userRoleDao = userRoleDao;
	}
}